<!DOCTYPE html>
<html>
<head>
    <title>演练可信评估</title>
    {% include 'admin/common/header.html' %}
    <link rel="stylesheet" href="{{ url_for('static', filename='/admin/admin/css/other/console3.css') }}"/>

    <!-- 主 题 更 换 -->
    <style id="pearadmin-bg-color"></style>

</head>
<body class="pear-container">
<div>
    <div class="layui-row layui-col-space10">
      <!--<div class="layui-col-md9">
            <div class="layui-card">
                <div class="layui-card-header">应急事件演练可信评估概况</div>
                <div class="layui-card-body">
                    <div id="echarts-pie1" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
                </div>
            </div>
        </div>-->
        <div class="layui-col-md9">
            <div class="layui-card">
                <div class="layui-card-header">应急事件评估分数</div>
                <div class="layui-card-body1">
                    <div class="layui-tab custom-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                        <div id="echarts-tree" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
                    </div>
                </div>
            </div>
 </div>
<!--        <div class="layui-col-md9">-->
<!--            <div class="layui-card">-->
<!--                <div class="layui-card-header">监所地点斗殴概率信息</div>-->
<!--                <div class="layui-card-body">-->
<!--                    <div class="layui-tab custom-tab layui-tab-brief" lay-filter="docDemoTabBrief">-->
<!--                        <div id="echarts-pie2" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>-->
<!--                    </div>-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
    </div>

</div>

<div class="layui-card">
                <div class="layui-card-header">火灾事件演练评估详细数据</div>
                <div class="layui-card-body">
                    <table id="rectification-table_fire" lay-filter="fire-table1"></table>
                </div>
</div>

<div class="layui-card">
                <div class="layui-card-header">地震事件演练评估详细数据</div>
                <div class="layui-card-body">
                    <table id="rectification-table_earth" lay-filter="fire-table1"></table>
                </div>
</div>

<div class="layui-card">
                <div class="layui-card-header">逃逸事件演练评估详细数据</div>
                <div class="layui-card-body">
                    <table id="rectification-table_run" lay-filter="fire-table1"></table>
                </div>
</div>

<div class="layui-card">
                <div class="layui-card-header">斗殴事件演练评估详细数据</div>
                <div class="layui-card-body">
                    <table id="rectification-table_fight" lay-filter="fire-table1"></table>
                </div>
</div>




<!--</div>-->

{% include 'admin/common/footer.html' %}
<script>

    //应急事件演练可信评估概况
    layui.use(['echarts'], function () {

        var echarts = layui.echarts
        var chartDom = document.getElementById('echarts-pie1');
        var myChart = echarts.init(chartDom);
        var option

        option = {
            angleAxis: {
                type: 'category',
                data: ['瞬时心率', '平均心率', '心率变异性', '活动能量', '移动速度', '步数', '移动距离']
            },
            radiusAxis: {},
            polar: {},
            series: [
                {
                    type: 'bar',
                    data: [1, 2, 3, 4, 3, 5, 1],
                    coordinateSystem: 'polar',
                    name: '火灾事件',
                    stack: 'a',
                    emphasis: {
                        focus: 'series'
                    }
                },
                {
                    type: 'bar',
                    data: [2, 4, 6, 1, 3, 2, 1],
                    coordinateSystem: 'polar',
                    name: '地震事件',
                    stack: 'a',
                    emphasis: {
                        focus: 'series'
                    }
                },
                {
                    type: 'bar',
                    data: [1, 2, 3, 4, 1, 2, 5],
                    coordinateSystem: 'polar',
                    name: '逃逸事件',
                    stack: 'a',
                    emphasis: {
                        focus: 'series'
                    }
                },
                     {
                    type: 'bar',
                    data: [4, 2, 3, 4, 1, 2, 5],
                    coordinateSystem: 'polar',
                    name: '斗殴事件',
                    stack: 'a',
                    emphasis: {
                        focus: 'series'
                    }
                }

            ],
            legend: {
                show: true,
                data: ['火灾事件', '地震事件', '逃逸事件', '斗殴事件']
            }
        };

        option && myChart.setOption(option);

        window.onresize = function () {
            myChart.resize()
        }

    })



    //火灾事件演练评估详细数据
    layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () {
        let table = layui.table
        let form = layui.form
        let $ = layui.jquery
        let popup = layui.popup
        let common = layui.common
        let MODULE_PATH = '/admin/credible/'

        // 表格数据
        let cols = [
            [
                { title: '应急事件源头', field: 'Name', align: 'center', width: 150 },
                //{ title: '是否应急演练', field: 'Occur', align: 'center' },
                { title: '演练应急处置方式', field: 'Method', align: 'center' },
                { title: '演练评估分数', field: 'Score', align: 'center', width: 120 },
                { title: '记录时间', field: 'create_at', templet: '#user-createTime', align: 'center' },
            ]
        ]

        // 渲染表格数据
        table.render({
            elem: '#rectification-table_fire',
            url: MODULE_PATH + 'credible_fire',
            page: true,
            cols: cols,
            skin: 'line',
            height: 'full-148',
            toolbar: '#user-toolbar', /*工具栏*/
            text: { none: '暂无信息' },
            defaultToolbar: [{ layEvent: 'refresh', icon: 'layui-icon-refresh' }, 'filter', 'print', 'exports'] /*默认工具栏*/
        })


        //
        $('.user-group').click(function () {
            let group = $(this).attr('user-group')
            let field = form.val('user-query-form')
            if (group === '-1') {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).prev().removeClass('button-primary')
                $(this).prev().addClass('button-default')
                $(this).addClass('button-primary')
            } else {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).next().removeClass('button-primary')
                $(this).next().addClass('button-default')
                $(this).addClass('button-primary')
            }
            window.refresh(field)
        })


        form.on('submit(user-query)', function (data) {
            window.refresh(data.field)
            return false
        })

        form.on('switch(user-enable)', function (obj) {
            let operate
            if (obj.elem.checked) {
                operate = 'enable'
            } else {
                operate = 'disable'
            }
            let loading = layer.load()
            $.ajax({
                url: '/admin/user/' + operate,
                data: JSON.stringify({ userId: this.value }),
                dataType: 'json',
                contentType: 'application/json',
                type: 'put',
                success: function (result) {
                    layer.close(loading)
                    if (result.success) {
                        popup.success(result.msg)
                    } else {
                        popup.failure(result.msg)
                    }
                }
            })
        })


        window.refresh = function (param) {
            table.reload('rectification-table', { where: param })
        }
    })

    //地震事件演练评估详细数据
    layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () {
        let table = layui.table
        let form = layui.form
        let $ = layui.jquery
        let popup = layui.popup
        let common = layui.common
        let MODULE_PATH = '/admin/credible/'

         // 表格数据
        let cols = [
            [
                { title: '应急事件源头', field: 'Name', align: 'center', width: 150 },
                //{ title: '是否应急演练', field: 'Occur', align: 'center' },
                { title: '演练应急处置方式', field: 'Method', align: 'center' },
                { title: '演练评估分数', field: 'Score', align: 'center', width: 120 },
                { title: '记录时间', field: 'create_at', templet: '#user-createTime', align: 'center' },
            ]
        ]

        // 渲染表格数据
        table.render({
            elem: '#rectification-table_earth',
            url: MODULE_PATH + 'credible_earthquake',
            page: true,
            cols: cols,
            skin: 'line',
            height: 'full-148',
            toolbar: '#user-toolbar', /*工具栏*/
            text: { none: '暂无信息' },
            defaultToolbar: [{ layEvent: 'refresh', icon: 'layui-icon-refresh' }, 'filter', 'print', 'exports'] /*默认工具栏*/
        })


        //
        $('.user-group').click(function () {
            let group = $(this).attr('user-group')
            let field = form.val('user-query-form')
            if (group === '-1') {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).prev().removeClass('button-primary')
                $(this).prev().addClass('button-default')
                $(this).addClass('button-primary')
            } else {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).next().removeClass('button-primary')
                $(this).next().addClass('button-default')
                $(this).addClass('button-primary')
            }
            window.refresh(field)
        })


        form.on('submit(user-query)', function (data) {
            window.refresh(data.field)
            return false
        })

        form.on('switch(user-enable)', function (obj) {
            let operate
            if (obj.elem.checked) {
                operate = 'enable'
            } else {
                operate = 'disable'
            }
            let loading = layer.load()
            $.ajax({
                url: '/admin/user/' + operate,
                data: JSON.stringify({ userId: this.value }),
                dataType: 'json',
                contentType: 'application/json',
                type: 'put',
                success: function (result) {
                    layer.close(loading)
                    if (result.success) {
                        popup.success(result.msg)
                    } else {
                        popup.failure(result.msg)
                    }
                }
            })
        })


        window.refresh = function (param) {
            table.reload('rectification-table', { where: param })
        }
    })

    //逃逸事件演练评估详细数据
    layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () {
        let table = layui.table
        let form = layui.form
        let $ = layui.jquery
        let popup = layui.popup
        let common = layui.common
        let MODULE_PATH = '/admin/credible/'

        // 表格数据
        let cols = [
            [
                { title: '应急事件源头', field: 'Name', align: 'center', width: 150 },
                //{ title: '是否应急演练', field: 'Occur', align: 'center' },
                { title: '演练应急处置方式', field: 'Method', align: 'center' },
                { title: '演练评估分数', field: 'Score', align: 'center', width: 120 },
                { title: '记录时间', field: 'create_at', templet: '#user-createTime', align: 'center' },
            ]
        ]

        // 渲染表格数据
        table.render({
            elem: '#rectification-table_run',
            url: MODULE_PATH + 'credible_run',
            page: true,
            cols: cols,
            skin: 'line',
            height: 'full-148',
            toolbar: '#user-toolbar', /*工具栏*/
            text: { none: '暂无信息' },
            defaultToolbar: [{ layEvent: 'refresh', icon: 'layui-icon-refresh' }, 'filter', 'print', 'exports'] /*默认工具栏*/
        })


        //
        $('.user-group').click(function () {
            let group = $(this).attr('user-group')
            let field = form.val('user-query-form')
            if (group === '-1') {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).prev().removeClass('button-primary')
                $(this).prev().addClass('button-default')
                $(this).addClass('button-primary')
            } else {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).next().removeClass('button-primary')
                $(this).next().addClass('button-default')
                $(this).addClass('button-primary')
            }
            window.refresh(field)
        })


        form.on('submit(user-query)', function (data) {
            window.refresh(data.field)
            return false
        })

        form.on('switch(user-enable)', function (obj) {
            let operate
            if (obj.elem.checked) {
                operate = 'enable'
            } else {
                operate = 'disable'
            }
            let loading = layer.load()
            $.ajax({
                url: '/admin/user/' + operate,
                data: JSON.stringify({ userId: this.value }),
                dataType: 'json',
                contentType: 'application/json',
                type: 'put',
                success: function (result) {
                    layer.close(loading)
                    if (result.success) {
                        popup.success(result.msg)
                    } else {
                        popup.failure(result.msg)
                    }
                }
            })
        })


        window.refresh = function (param) {
            table.reload('rectification-table', { where: param })
        }
    })

    //斗殴事件演练评估详细数据
    layui.use(['table', 'form', 'jquery', 'popup', 'common'], function () {
        let table = layui.table
        let form = layui.form
        let $ = layui.jquery
        let popup = layui.popup
        let common = layui.common
        let MODULE_PATH = '/admin/credible/'

       // 表格数据
        let cols = [
            [
                { title: '应急事件源头', field: 'Name', align: 'center', width: 150 },
                //{ title: '是否应急演练', field: 'Occur', align: 'center' },
                { title: '演练应急处置方式', field: 'Method', align: 'center' },
                { title: '演练评估分数', field: 'Score', align: 'center', width: 120 },
                { title: '记录时间', field: 'create_at', templet: '#user-createTime', align: 'center' },
            ]
        ]

        // 渲染表格数据
        table.render({
            elem: '#rectification-table_fight',
            url: MODULE_PATH + 'credible_fight',
            page: true,
            cols: cols,
            skin: 'line',
            height: 'full-148',
            toolbar: '#user-toolbar', /*工具栏*/
            text: { none: '暂无信息' },
            defaultToolbar: [{ layEvent: 'refresh', icon: 'layui-icon-refresh' }, 'filter', 'print', 'exports'] /*默认工具栏*/
        })


        //
        $('.user-group').click(function () {
            let group = $(this).attr('user-group')
            let field = form.val('user-query-form')
            if (group === '-1') {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).prev().removeClass('button-primary')
                $(this).prev().addClass('button-default')
                $(this).addClass('button-primary')
            } else {
                field.deptId = group
                $(this).removeClass('button-default')
                $(this).next().removeClass('button-primary')
                $(this).next().addClass('button-default')
                $(this).addClass('button-primary')
            }
            window.refresh(field)
        })


        form.on('submit(user-query)', function (data) {
            window.refresh(data.field)
            return false
        })

        form.on('switch(user-enable)', function (obj) {
            let operate
            if (obj.elem.checked) {
                operate = 'enable'
            } else {
                operate = 'disable'
            }
            let loading = layer.load()
            $.ajax({
                url: '/admin/user/' + operate,
                data: JSON.stringify({ userId: this.value }),
                dataType: 'json',
                contentType: 'application/json',
                type: 'put',
                success: function (result) {
                    layer.close(loading)
                    if (result.success) {
                        popup.success(result.msg)
                    } else {
                        popup.failure(result.msg)
                    }
                }
            })
        })


        window.refresh = function (param) {
            table.reload('rectification-table', { where: param })
        }
    })


    //人员进出统计
    layui.use(['echarts'], function () {

        var echarts = layui.echarts
        var chartDom = document.getElementById('echarts-tree');
        var myChart = echarts.init(chartDom);
        var option

        option = {
            title: {
                text: '应急事件演练评估分数情况',
                subtext: '分数'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data: ['演练分数']
            },
            toolbox: {
                show: true,
                feature: {
                    dataView: { show: true, readOnly: false },
                    magicType: { show: true, type: ['line', 'bar'] },
                    restore: { show: true },
                    saveAsImage: { show: true }
                }
            },
            calculable: true,
            xAxis: [
                {
                    type: 'category',
                    // prettier-ignore
                    data: ['演练次数1', '演练次数2', '演练次数3', '演练次数4']
                }
            ],
            yAxis: [
                {
                    type: 'value'
                }
            ],
            series: [
                {
                    name: '火灾应急演练分数',
                    type: 'bar',
                    data: [
                        80, 90, 70
                    ],
                    markPoint: {
                        data: [
                            { type: 'max', name: 'Max' },
                            { type: 'min', name: 'Min' }
                        ]
                    },
                    markLine: {
                        data: [{ type: 'average', name: 'Avg' }]
                    }
                },
                 {
                    name: '地震应急演练分数',
                    type: 'bar',
                    data: [
                        60
                    ],
                    markPoint: {
                        data: [
                            { type: 'max', name: 'Max' },
                            { type: 'min', name: 'Min' }
                        ]
                    },
                    markLine: {
                        data: [{ type: 'average', name: 'Avg' }]
                    }
                },
                {
                    name: '逃逸应急演练分数',
                    type: 'bar',
                    data: [
                        80,70,90,100
                    ],
                    markPoint: {
                        data: [
                            { type: 'max', name: 'Max' },
                            { type: 'min', name: 'Min' }
                        ]
                    },
                    markLine: {
                        data: [{ type: 'average', name: 'Avg' }]
                    }
                },
                {
                    name: '斗殴应急演练分数',
                    type: 'bar',
                    data: [
                        90,90,95
                    ],
                    markPoint: {
                        data: [
                            { type: 'max', name: 'Max' },
                            { type: 'min', name: 'Min' }
                        ]
                    },
                    markLine: {
                        data: [{ type: 'average', name: 'Avg' }]
                    }
                },

            ]
        };


        option && myChart.setOption(option);

        window.onresize = function () {
            myChart.resize()
        }

    })


</script>
</body>
</html>